"""
异步的 MongoDB 客户端
"""

from motor.core import (
    AgnosticClient,
    AgnosticDatabase,
)
from motor.motor_asyncio import AsyncIOMotorClient

from config import settings

async_mongodb_client: AgnosticClient = AsyncIOMotorClient(settings.MONGODB.URI)
""" MongoDB 客户端对象 """

async_mongo_db: AgnosticDatabase = async_mongodb_client[settings.MONGODB.DB_NAME]
""" MongoDB 数据库对象 """


async def get_database() -> AgnosticDatabase:
    """ 获取数据库对象（异步） """

    return async_mongo_db
